package com.qfedu.tantu.controller;

import com.qfedu.tantu.service.intf.CityService;
import com.qfedu.tantu.vo.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author:rongrong
 * @Description:
 * @Date:Create in 2022/7/2 21:51
 **/

@RestController
@RequestMapping("/api/city/")
@CrossOrigin
@Api
public class CityController {
    @Resource
    private CityService cityService;

    @RequestMapping("selectPage.do")
    public R selectPage(int start,int size){
        System.out.println("请求到了");
        R r = cityService.selectPage(start, size);
        return r;
    }

    @RequestMapping("showAll.do")
    public R showAll(int id){
        return cityService.showAll(id);
    }

    @RequestMapping("selectIdByName.do")
    public R selectIdByName(String name){
        return cityService.selectIdByName(name);
    }

    @RequestMapping("selectByName")
    public R selectByName(String name){
        return cityService.selectByName(name);
    }


    //通过 游记数量降序排列 城市
    @ApiOperation("游记数量排序")
    @GetMapping("ord.do")
    public R ord(){
        return cityService.ord();

    }
}
